package com.chuangke.flow.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.chuangke.common.http.HttpResult;
import com.chuangke.flow.entity.FlowBasic;
import com.chuangke.flow.service.FlowBasicService;

/**
 * implController
 * 
 * @author chuangke
 * @date "2020-12-29"
 */
@RestController
@RequestMapping("/basic/flow")
public class FlowBasicController {
    
    @Autowired
    private FlowBasicService flowBasicService;

    /**
     * 查询impl列表
     */
    @PreAuthorize("hasAuthority('login:action')")
    @GetMapping("/list")
    public HttpResult list(FlowBasic flowBasic) {
        List<FlowBasic> list = flowBasicService.selectFlowBasicList(flowBasic);
        return HttpResult.ok(list);
    }

    /**
     * 新增impl
     */
    @PreAuthorize("hasAuthority('login:action')")
    @PostMapping(value = "/save")
    public HttpResult save(@RequestBody FlowBasic flowBasic) {
    	flowBasicService.saveOrUpdateFlowBasic(flowBasic);
        return HttpResult.ok();
    }

    /**
     * 删除impl
     */
    @PreAuthorize("hasAuthority('login:action')")
	@GetMapping("/{ids}")
    public HttpResult remove(@PathVariable List<String> ids) {
    	flowBasicService.deleteFlowBasicByIds(ids);
        return HttpResult.ok();
    }
}